<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Model;

/**
 * Class Order
 */
class Orders extends Model
{
    protected $table = 'orders';

    public $timestamps = true;

    protected $fillable = [
        'uid',
        'sn',
        'order_name',
        'order_type',
        'order_status',
        'relation_id',
        'phone',
        'pay_number',
        'pay_time',
        'money'
    ];

    protected $guarded = [];

    public function website()
    {
        return $this->hasOne('App\Models\Admin\Website','id','relation_id');
    }

    public function company()
    {
        return $this->hasOne('App\Models\Admin\Company','id','relation_id');
    }

    /**
     * @param \DateTime|int $value
     * @return false|int
     * @author dividez
     */
    public function fromDateTime($value){
        return strtotime(parent::fromDateTime($value));
    }
}